﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using Etong.Web;
/// <summary>
///ConfigGlobalSettings 的摘要说明
/// </summary>
public class ConfigGlobalSettings
{
	public ConfigGlobalSettings()
	{
        Theme = "default";
        AdminDir = "~/admin/";
	}

    public bool AllowBrowseControl { get; set; }

    public string AdminTableName { get; set; }
    public string AdminPKColumnField { get; set; }
    public string UserNameColumnField { get; set; }
    public string PasswordColumnField { get; set; }
    public string RoleColumnField { get; set; }

    public string RoleTableName { get; set; }
    public string RoleTablePkFieldName { get; set; }
    public string RoleTableNameFieldName { get; set; }
    public bool AllowRole { get; set; }
    public string AdminDir { get; set; }

    public string Theme { get; set; }

    public DBType DbType { get; set; }

    public string ConnectionStringName { get; set; }
    public string ConnectionString
    {
        get
        {
            return ConfigurationManager.ConnectionStrings[this.ConnectionStringName].ConnectionString;
        }
    }

    public void Save()
    {
        string path = HttpContext.Current.Server.MapPath("~/configs/ConfigGlobalSettings.xml");
        this.ObjToXml(path);
    }
}
